﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CE.User;
using CE.Global;
using CE.Provider;

public partial class Provider_PersonalAccident_AddNewBenefitScale : System.Web.UI.Page
{
    string PageName = "CXPA";
    string SubPageName = "CXPABS";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[CE.Global.General.UserId] == null || Session[CE.Global.General.ProviderCompanyId] == null)
        {
            Response.Redirect("~/Provider/ProviderSecureLogin.aspx");
        }
        CheckMainPageAccess();
        CheckSubPageAccess();

        if (!IsPostBack)
        {
            ClearProcess();
            LoadPlanName();
            LoadBenefitName();
            ddlPlanName.SelectedValue = "-1";
            ddlBenefitName.SelectedValue = "-1";
            Int64 _painsid;
            Int64 _pacompanyid = Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString());
            if (_pacompanyid != 30)
            {
                pnlPercentage.Visible = true;
                pnlAmount.Visible = false;
            }
            else if (_pacompanyid == 30)
            {
                pnlPercentage.Visible = false;
                pnlAmount.Visible = true;
            }
            if (Request.Params["PABenefitId"] != null)
            {
                if (Int64.TryParse(Request.Params["PABenefitId"].ToString(), out _painsid))
                {
                    ddlPlanName.Enabled = false;
                    ddlBenefitName.Enabled = false;
                    ddlPolicyType.Enabled = false;
                    ShowPABenefitDetails(_pacompanyid, _painsid);
                }
            }
        }
    }

    protected void ibtSubmit_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            BenefitScale _benefitscale = new BenefitScale();
            BenefitScaleDB _benefitscaledb = new BenefitScaleDB();

            Int64 _pabenefitid = 0;
            if (Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString()) != 30)
            {
                _benefitscale.PABenefitId = Convert.ToInt64(lblPABenifitId.Text.ToString());
                _benefitscale.PAInsId = Convert.ToInt64(ddlBenefitName.Text.ToString());
                _benefitscale.PACompanyId = Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString());
                _benefitscale.PolicyType = ddlPolicyType.Text;
                _benefitscale.DeathPerDisable = Convert.ToInt32(txtDeathPTD.Text.ToString());
                _benefitscale.LossLimb = Convert.ToInt32(txtLossOneLimb.Text.ToString());
                _benefitscale.LossTwoLimbs = Convert.ToInt32(txtLossTwoLimb.Text.ToString());
                _benefitscale.LossOneEye = Convert.ToInt32(txtLossShightOneeye.Text.ToString());
                _benefitscale.LossBothEye = Convert.ToInt32(txtLossShightBotheye.Text.ToString());
                _benefitscale.LossOneEar = Convert.ToInt32(txtLossHearingOneear.Text.ToString());
                _benefitscale.LossBothEar = Convert.ToInt32(txtLossHearingBothear.Text.ToString());
                _benefitscale.LossSpeech = Convert.ToInt32(txtLossSpeech.Text.ToString());
                _benefitscale.TotParalysis = Convert.ToInt32(txtTotalParalysis.Text.ToString());
                _benefitscale.PerBedridden = Convert.ToInt32(txtPerBedridden.Text.ToString());
                _benefitscale.LossFinRH = Convert.ToInt32(txtLossFingRH.Text.ToString());
                _benefitscale.LossFinLH = Convert.ToInt32(txtLossFingLH.Text.ToString());
                _benefitscale.LossFinOneHand = Convert.ToInt32(txtLossFingOneHand.Text.ToString());
                _benefitscale.LossThumbBothPhalanges = Convert.ToInt32(txtLossThumbBothPhalanges.Text.ToString());
                _benefitscale.LossThumbRPhalanx = Convert.ToInt32(txtLossThumbRPhalanx.Text.ToString());
                _benefitscale.LossThumbLPhalanx = Convert.ToInt32(txtLossThumbLPhalanx.Text.ToString());
                _benefitscale.LossIndexFinThreePhalanges = Convert.ToInt32(txtLossIndexFinThreePhalanges.Text.ToString());
                _benefitscale.LossIndexFinTwoPhalanges = Convert.ToInt32(txtLossIndexFinTwoPhalanges.Text.ToString());
                _benefitscale.LossIndexFinOnePhalanx = Convert.ToInt32(txtLossIndexFinOnePhalanx.Text.ToString());
                _benefitscale.LossMidFinThreePhalanges = Convert.ToInt32(txtLossMidFinThreePhalanges.Text.ToString());
                _benefitscale.LossMidFinTwoPhalanges = Convert.ToInt32(txtLossMidFinTwoPhalanges.Text.ToString());
                _benefitscale.LossMidFinOnePhalanx = Convert.ToInt32(txtLossMidFinOnePhalanx.Text.ToString());
                _benefitscale.LossRingFinThreePhalanges = Convert.ToInt32(txtLossRingFinThreePhalanges.Text.ToString());
                _benefitscale.LossRingFinTwoPhalanges = Convert.ToInt32(txtLossRingFinTwoPhalanges.Text.ToString());
                _benefitscale.LossRingFinOnePhalanx = Convert.ToInt32(txtLossRingFinOnePhalanx.Text.ToString());
                _benefitscale.LossLitFinThreePhalanges = Convert.ToInt32(txtLossLitFinThreePhalanges.Text.ToString());
                _benefitscale.LossLitFinTwoPhalanges = Convert.ToInt32(txtLossLitFinTwoPhalanges.Text.ToString());
                _benefitscale.LossLitFinOnePhalanx = Convert.ToInt32(txtLossLitFinOnePhalanx.Text.ToString());
                _benefitscale.LossAllToesOneFoot = Convert.ToInt32(txtLossAllToesOneFoot.Text.ToString());
                _benefitscale.LossGToeTwoPhalanges = Convert.ToInt32(txtLossGToeTwoPhalanges.Text.ToString());
                _benefitscale.LossGToeOnePhalanx = Convert.ToInt32(txtLossGToeOnePhalanx.Text.ToString());
                _benefitscale.LossOToeOneMorePhalanges = Convert.ToInt32(txtLossOToeOneMorePhalanges.Text.ToString());
                _benefitscale.ThirdDegreeBurn = txtThirdDegreeBurn.Text.ToString();
            }
            else if (Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString()) == 30)
            {
                _benefitscale.PABenefitId = Convert.ToInt64(lblPABenifitId.Text.ToString());
                _benefitscale.PAInsId = Convert.ToInt64(ddlBenefitName.Text.ToString());
                _benefitscale.PACompanyId = Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString());
                _benefitscale.PolicyType = ddlPolicyType.Text;

                _benefitscale.DeathPerDisable = Convert.ToInt32(txtDeathPTDCash.Text.ToString());
                _benefitscale.TotParalysis = Convert.ToInt32(txtTotalParalysisCash.Text.ToString());
                _benefitscale.LossBothEye = Convert.ToInt32(txtLossShightBotheyeCash.Text.ToString());
                _benefitscale.LossSpeech = Convert.ToInt32(txtLossSpeechCash.Text.ToString());
                _benefitscale.LossBothEar = Convert.ToInt32(txtLossHearingBothearCash.Text.ToString());
                _benefitscale.LossOneEye = Convert.ToInt32(txtLossShightOneeyeCash.Text.ToString());
                _benefitscale.LossOneEar = Convert.ToInt32(txtLossHearingOneearCash.Text.ToString());
                _benefitscale.PerBedridden = Convert.ToInt32(txtLossSEHKAWCash.Text.ToString()); //Shoulder, elbow,hip,knee,angle or wrist
                _benefitscale.LossThumbBothPhalanges = Convert.ToInt32(txtLossOneThumbCash.Text.ToString()); //One Thumb
                _benefitscale.LossFinOneHand = Convert.ToInt32(txtLossOneforefingerCash.Text.ToString()); //One forefinger
                _benefitscale.LossGToeOnePhalanx = Convert.ToInt32(txtOthFingerOnebigtoeCash.Text.ToString()); // Any other finger or one big toe
                _benefitscale.LossOToeOneMorePhalanges = Convert.ToInt32(txtAnyOthertoeCash.Text.ToString()); // Any other toe

                _benefitscale.LossLimb = 0;
                _benefitscale.LossTwoLimbs = 0;
                _benefitscale.LossFinRH = 0;
                _benefitscale.LossFinLH = 0;
                _benefitscale.LossThumbRPhalanx = 0;
                _benefitscale.LossThumbLPhalanx = 0;
                _benefitscale.LossIndexFinThreePhalanges = 0;
                _benefitscale.LossIndexFinTwoPhalanges = 0;
                _benefitscale.LossIndexFinOnePhalanx = 0;
                _benefitscale.LossMidFinThreePhalanges = 0;
                _benefitscale.LossMidFinTwoPhalanges = 0;
                _benefitscale.LossMidFinOnePhalanx = 0;
                _benefitscale.LossRingFinThreePhalanges = 0;
                _benefitscale.LossRingFinTwoPhalanges = 0;
                _benefitscale.LossRingFinOnePhalanx = 0;
                _benefitscale.LossLitFinThreePhalanges = 0;
                _benefitscale.LossLitFinTwoPhalanges = 0;
                _benefitscale.LossLitFinOnePhalanx = 0;
                _benefitscale.LossAllToesOneFoot = 0;
                _benefitscale.LossGToeTwoPhalanges = 0;
                _benefitscale.ThirdDegreeBurn = " ";
            }
            _benefitscale.Status = chkStatus.Checked;
            _benefitscale.RefCEUserId = Convert.ToInt64(Session[CE.Global.General.UserId].ToString());
            _pabenefitid = _benefitscaledb.Insert(_benefitscale);
            if (_pabenefitid > 0)
            {
                Response.Redirect("~/Provider/PersonalAccident/ViewBenefitScale.aspx");
            }
        }
    }

    protected void btnNew_Click(object sender, ImageClickEventArgs e)
    {
        ClearProcess();
    }

    protected void ibtBack_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("~/Provider/PersonalAccident/PAInsuranceHome.aspx");
    }

    protected void ddlPlanName_SelectedIndexChanged(object sender, EventArgs e)
    {
        LoadBenefitName();
    }

    protected void ddlPolicyType_SelectedIndexChanged(object sender, EventArgs e)
    {
        LoadBenefitName();
    }

    protected void ddlBenefitName_SelectedIndexChanged(object sender, EventArgs e)
    {
        lblPAInsId.Text = ddlBenefitName.Text;
        //lblPABenifitId.Text = ddlBenefitName.Text;
        Int64 _painsid = Convert.ToInt64(lblPAInsId.Text);
        Int64 _pacompanyid = Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString());
        if (ddlPlanName.SelectedIndex > 0 && ddlBenefitName.SelectedValue != "-1")
        {
            ShowPABenefitDetails(_pacompanyid, _painsid);
        }
        else
        {
            lblPABenifitId.Text = "0";
            ClearTextBox();
        }
    }

    private void ShowPABenefitDetails(Int64 PACompanyId, Int64 PAInsId)
    {
        BenefitScale _benefitscale = new BenefitScale();
        BenefitScaleDB _benefitscaledb = new BenefitScaleDB();
        _benefitscale = _benefitscaledb.GetBenefitScale(PACompanyId, PAInsId);

        if (_benefitscale != null)
        {
            if (_benefitscale.PAInsId.ToString() != "0")
            {
                lblPAInsId.Text = _benefitscale.PAInsId.ToString();
                lblPABenifitId.Text = _benefitscale.PABenefitId.ToString();
                ddlPolicyType.Text = _benefitscale.PolicyType.ToString();
                ddlPlanName.SelectedValue = _benefitscale.PlanName.ToString();
                //LoadBenefitName();
                ddlBenefitName.Text = _benefitscale.PAInsId.ToString();
                if (Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString()) != 30)
                {
                    pnlPercentage.Visible = true;
                    pnlAmount.Visible = false;
                    txtDeathPTD.Text = _benefitscale.DeathPerDisable.ToString();
                    txtLossOneLimb.Text = _benefitscale.LossLimb.ToString();
                    txtLossTwoLimb.Text = _benefitscale.LossTwoLimbs.ToString();
                    txtLossShightOneeye.Text = _benefitscale.LossOneEye.ToString();
                    txtLossShightBotheye.Text = _benefitscale.LossBothEye.ToString();
                    txtLossHearingOneear.Text = _benefitscale.LossOneEar.ToString();
                    txtLossHearingBothear.Text = _benefitscale.LossBothEar.ToString();
                    txtLossSpeech.Text = _benefitscale.LossSpeech.ToString();
                    txtTotalParalysis.Text = _benefitscale.TotParalysis.ToString();
                    txtPerBedridden.Text = _benefitscale.PerBedridden.ToString();
                    txtLossFingRH.Text = _benefitscale.LossFinRH.ToString();
                    txtLossFingLH.Text = _benefitscale.LossFinLH.ToString();
                    txtLossFingOneHand.Text = _benefitscale.LossFinOneHand.ToString();
                    txtLossThumbBothPhalanges.Text = _benefitscale.LossThumbBothPhalanges.ToString();
                    txtLossThumbRPhalanx.Text = _benefitscale.LossThumbRPhalanx.ToString();
                    txtLossThumbLPhalanx.Text = _benefitscale.LossThumbLPhalanx.ToString();
                    txtLossIndexFinThreePhalanges.Text = _benefitscale.LossIndexFinThreePhalanges.ToString();
                    txtLossIndexFinTwoPhalanges.Text = _benefitscale.LossIndexFinTwoPhalanges.ToString();
                    txtLossIndexFinOnePhalanx.Text = _benefitscale.LossIndexFinOnePhalanx.ToString();
                    txtLossMidFinThreePhalanges.Text = _benefitscale.LossMidFinThreePhalanges.ToString();
                    txtLossMidFinTwoPhalanges.Text = _benefitscale.LossMidFinTwoPhalanges.ToString();
                    txtLossMidFinOnePhalanx.Text = _benefitscale.LossMidFinOnePhalanx.ToString();
                    txtLossRingFinThreePhalanges.Text = _benefitscale.LossRingFinThreePhalanges.ToString();
                    txtLossRingFinTwoPhalanges.Text = _benefitscale.LossRingFinTwoPhalanges.ToString();
                    txtLossRingFinOnePhalanx.Text = _benefitscale.LossRingFinOnePhalanx.ToString();
                    txtLossLitFinThreePhalanges.Text = _benefitscale.LossLitFinThreePhalanges.ToString();
                    txtLossLitFinTwoPhalanges.Text = _benefitscale.LossLitFinTwoPhalanges.ToString();
                    txtLossLitFinOnePhalanx.Text = _benefitscale.LossLitFinOnePhalanx.ToString();
                    txtLossAllToesOneFoot.Text = _benefitscale.LossAllToesOneFoot.ToString();
                    txtLossGToeTwoPhalanges.Text = _benefitscale.LossGToeTwoPhalanges.ToString();
                    txtLossGToeOnePhalanx.Text = _benefitscale.LossGToeOnePhalanx.ToString();
                    txtLossOToeOneMorePhalanges.Text = _benefitscale.LossOToeOneMorePhalanges.ToString();
                    txtThirdDegreeBurn.Text = _benefitscale.ThirdDegreeBurn.ToString();

                    txtDeathPTDCash.Text = "0";
                    txtTotalParalysisCash.Text = "0";
                    txtLossShightBotheyeCash.Text = "0";
                    txtLossSpeechCash.Text = "0";
                    txtLossHearingBothearCash.Text = "0";
                    txtLossShightOneeyeCash.Text = "0";
                    txtLossHearingOneearCash.Text = "0";
                    txtLossSEHKAWCash.Text = "0";
                    txtLossOneThumbCash.Text = "0";
                    txtLossOneforefingerCash.Text = "0";
                    txtOthFingerOnebigtoeCash.Text = "0";
                    txtAnyOthertoeCash.Text = "0";
                }
                else if (Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString()) == 30)
                {
                    pnlPercentage.Visible = false;
                    pnlAmount.Visible = true;
                    txtDeathPTDCash.Text = _benefitscale.DeathPerDisable.ToString();
                    txtTotalParalysisCash.Text = _benefitscale.TotParalysis.ToString();
                    txtLossShightBotheyeCash.Text = _benefitscale.LossBothEye.ToString();
                    txtLossSpeechCash.Text = _benefitscale.LossSpeech.ToString();
                    txtLossHearingBothearCash.Text = _benefitscale.LossBothEar.ToString();
                    txtLossShightOneeyeCash.Text = _benefitscale.LossOneEye.ToString();
                    txtLossHearingOneearCash.Text = _benefitscale.LossOneEar.ToString();
                    txtLossSEHKAWCash.Text = _benefitscale.PerBedridden.ToString();
                    txtLossOneThumbCash.Text = _benefitscale.LossThumbBothPhalanges.ToString();
                    txtLossOneforefingerCash.Text = _benefitscale.LossFinOneHand.ToString();
                    txtOthFingerOnebigtoeCash.Text = _benefitscale.LossGToeOnePhalanx.ToString();
                    txtAnyOthertoeCash.Text = _benefitscale.LossOToeOneMorePhalanges.ToString();

                    txtDeathPTD.Text = "0";
                    txtLossOneLimb.Text = "0";
                    txtLossTwoLimb.Text = "0";
                    txtLossShightOneeye.Text = "0";
                    txtLossShightBotheye.Text = "0";
                    txtLossHearingOneear.Text = "0";
                    txtLossHearingBothear.Text = "0";
                    txtLossSpeech.Text = "0";
                    txtTotalParalysis.Text = "0";
                    txtPerBedridden.Text = "0";
                    txtLossFingRH.Text = "0";
                    txtLossFingLH.Text = "0";
                    txtLossFingOneHand.Text = "0";
                    txtLossThumbBothPhalanges.Text = "0";
                    txtLossThumbRPhalanx.Text = "0";
                    txtLossThumbLPhalanx.Text = "0";
                    txtLossIndexFinThreePhalanges.Text = "0";
                    txtLossIndexFinTwoPhalanges.Text = "0";
                    txtLossIndexFinOnePhalanx.Text = "0";
                    txtLossMidFinThreePhalanges.Text = "0";
                    txtLossMidFinTwoPhalanges.Text = "0";
                    txtLossMidFinOnePhalanx.Text = "0";
                    txtLossRingFinThreePhalanges.Text = "0";
                    txtLossRingFinTwoPhalanges.Text = "0";
                    txtLossRingFinOnePhalanx.Text = "0";
                    txtLossLitFinThreePhalanges.Text = "0";
                    txtLossLitFinTwoPhalanges.Text = "0";
                    txtLossLitFinOnePhalanx.Text = "0";
                    txtLossAllToesOneFoot.Text = "0";
                    txtLossGToeTwoPhalanges.Text = "0";
                    txtLossGToeOnePhalanx.Text = "0";
                    txtLossOToeOneMorePhalanges.Text = "0";
                    txtThirdDegreeBurn.Text = "0";
                }
                chkStatus.Checked = Convert.ToBoolean(_benefitscale.Status.ToString());
            }
            else
            {
                ClearTextBox();
            }
        }
        else
        {
            ClearTextBox();
        }
    }

    private void LoadPlanName()
    {
        CompareBenefitsDB _comparebenefitsdb = new CompareBenefitsDB();
        Int64 _PACompanyId = Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString());
        Int64 _UserId = Convert.ToInt64(Session[CE.Global.General.UserId].ToString());
        //DataTable _dtPlan = _comparebenefitsdb.GetPlanNames(_PACompanyId, _UserId);
        DataTable _dtPlan = _comparebenefitsdb.GetPlanNames(_PACompanyId);
        _dtPlan.DefaultView.Sort = "PlanName asc";

        ddlPlanName.DataSource = _dtPlan.DefaultView.Table;
        ddlPlanName.DataValueField = _dtPlan.Columns[0].ColumnName.ToString();
        ddlPlanName.DataTextField = _dtPlan.Columns[0].ColumnName.ToString();
        ddlPlanName.DataBind();

        ddlPlanName.Items.Insert(0, new ListItem("Select", "-1"));
    }

    private void LoadBenefitName()
    {
        DataTable _dtBenefit = new DataTable();
        CompareBenefitsDB _comparebenefitsdb = new CompareBenefitsDB();
        Int64 _PACompanyId = Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString());
        Int64 _UserId = Convert.ToInt64(Session[CE.Global.General.UserId].ToString());
        if (ddlPlanName.SelectedIndex > 0 && ddlPolicyType.SelectedIndex > 0)
        {
            _dtBenefit = _comparebenefitsdb.GetBenefitNames(_PACompanyId, ddlPlanName.Text, ddlPolicyType.Text);
            //_dtBenefit = _comparebenefitsdb.GetBenefitNames(_PACompanyId, _UserId, ddlPlanName.Text);
        }
        else
        {
            _dtBenefit = _comparebenefitsdb.GetBenefitNames(_PACompanyId);
            //_dtBenefit = _comparebenefitsdb.GetBenefitNames(_PACompanyId, _UserId);
        }
        _dtBenefit.DefaultView.Sort = "BenefitName asc";
        ddlBenefitName.Items.Clear();
        ddlBenefitName.DataSource = _dtBenefit.DefaultView.Table;
        ddlBenefitName.DataValueField = _dtBenefit.Columns[0].ColumnName.ToString();
        ddlBenefitName.DataTextField = _dtBenefit.Columns[1].ColumnName.ToString();
        ddlBenefitName.DataBind();

        ddlBenefitName.Items.Insert(0, new ListItem("Select", "-1"));
    }

    private void ClearProcess()
    {
        ddlPlanName.Enabled = true;
        ddlBenefitName.Enabled = true;
        ddlPolicyType.Enabled = true;
        ddlPlanName.SelectedIndex = 0;
        ddlBenefitName.SelectedIndex = 0;
        lblPAInsId.Text = "0";
        lblPABenifitId.Text = "0";

        txtDeathPTD.Text = "";
        txtLossOneLimb.Text = "";
        txtLossTwoLimb.Text = "";
        txtLossShightOneeye.Text = "";
        txtLossShightBotheye.Text = "";
        txtLossHearingOneear.Text = "";
        txtLossHearingBothear.Text = "";
        txtLossSpeech.Text = "";
        txtTotalParalysis.Text = "";
        txtPerBedridden.Text = "";
        txtLossFingRH.Text = "";
        txtLossFingLH.Text = "";
        txtLossFingOneHand.Text = "";
        txtLossThumbBothPhalanges.Text = "";
        txtLossThumbRPhalanx.Text = "";
        txtLossThumbLPhalanx.Text = "";
        txtLossIndexFinThreePhalanges.Text = "";
        txtLossIndexFinTwoPhalanges.Text = "";
        txtLossIndexFinOnePhalanx.Text = "";
        txtLossMidFinThreePhalanges.Text = "";
        txtLossMidFinTwoPhalanges.Text = "";
        txtLossMidFinOnePhalanx.Text = "";
        txtLossRingFinThreePhalanges.Text = "";
        txtLossRingFinTwoPhalanges.Text = "";
        txtLossRingFinOnePhalanx.Text = "";
        txtLossLitFinThreePhalanges.Text = "";
        txtLossLitFinTwoPhalanges.Text = "";
        txtLossLitFinOnePhalanx.Text = "";
        txtLossAllToesOneFoot.Text = "";
        txtLossGToeTwoPhalanges.Text = "";
        txtLossGToeOnePhalanx.Text = "";
        txtLossOToeOneMorePhalanges.Text = "";
        txtThirdDegreeBurn.Text = "";

        txtDeathPTDCash.Text = "";
        txtTotalParalysisCash.Text = "";
        txtLossShightBotheyeCash.Text = "";
        txtLossSpeechCash.Text = "";
        txtLossHearingBothearCash.Text = "";
        txtLossShightOneeyeCash.Text = "";
        txtLossHearingOneearCash.Text = "";
        txtLossSEHKAWCash.Text = "";
        txtLossOneThumbCash.Text = "";
        txtLossOneforefingerCash.Text = "";
        txtOthFingerOnebigtoeCash.Text = "";
        txtAnyOthertoeCash.Text = "";


        chkStatus.Checked = true;
    }

    private void ClearTextBox()
    {
        //txtDeathPTD.Text = "";
        //txtLossOneLimb.Text = "";
        //txtLossTwoLimb.Text = "";
        //txtLossShightOneeye.Text = "";
        //txtLossShightBotheye.Text = "";
        //txtLossHearingOneear.Text = "";
        //txtLossHearingBothear.Text = "";
        //txtLossSpeech.Text = "";
        //txtTotalParalysis.Text = "";
        //txtPerBedridden.Text = "";
        //txtLossFingRH.Text = "";
        //txtLossFingLH.Text = "";
        //txtLossFingOneHand.Text = "";
        //txtLossThumbBothPhalanges.Text = "";
        //txtLossThumbRPhalanx.Text = "";
        //txtLossThumbLPhalanx.Text = "";
        //txtLossIndexFinThreePhalanges.Text = "";
        //txtLossIndexFinTwoPhalanges.Text = "";
        //txtLossIndexFinOnePhalanx.Text = "";
        //txtLossMidFinThreePhalanges.Text = "";
        //txtLossMidFinTwoPhalanges.Text = "";
        //txtLossMidFinOnePhalanx.Text = "";
        //txtLossRingFinThreePhalanges.Text = "";
        //txtLossRingFinTwoPhalanges.Text = "";
        //txtLossRingFinOnePhalanx.Text = "";
        //txtLossLitFinThreePhalanges.Text = "";
        //txtLossLitFinTwoPhalanges.Text = "";
        //txtLossLitFinOnePhalanx.Text = "";
        //txtLossAllToesOneFoot.Text = "";
        //txtLossGToeTwoPhalanges.Text = "";
        //txtLossGToeOnePhalanx.Text = "";
        //txtLossOToeOneMorePhalanges.Text = "";
        //txtThirdDegreeBurn.Text = "";

        //txtDeathPTDCash.Text = "";
        //txtTotalParalysisCash.Text = "";
        //txtLossShightBotheyeCash.Text = "";
        //txtLossSpeechCash.Text = "";
        //txtLossHearingBothearCash.Text = "";
        //txtLossShightOneeyeCash.Text = "";
        //txtLossHearingOneearCash.Text = "";
        //txtLossSEHKAWCash.Text = "";
        //txtLossOneThumbCash.Text = "";
        //txtLossOneforefingerCash.Text = "";
        //txtOthFingerOnebigtoeCash.Text = "";
        //txtAnyOthertoeCash.Text = "";

        if (Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString()) != 30)
        {
            pnlPercentage.Visible = true;
            pnlAmount.Visible = false;
            txtDeathPTD.Text = "";
            txtLossOneLimb.Text = "";
            txtLossTwoLimb.Text = "";
            txtLossShightOneeye.Text = "";
            txtLossShightBotheye.Text = "";
            txtLossHearingOneear.Text = "";
            txtLossHearingBothear.Text = "";
            txtLossSpeech.Text = "";
            txtTotalParalysis.Text = "";
            txtPerBedridden.Text = "";
            txtLossFingRH.Text = "";
            txtLossFingLH.Text = "";
            txtLossFingOneHand.Text = "";
            txtLossThumbBothPhalanges.Text = "";
            txtLossThumbRPhalanx.Text = "";
            txtLossThumbLPhalanx.Text = "";
            txtLossIndexFinThreePhalanges.Text = "";
            txtLossIndexFinTwoPhalanges.Text = "";
            txtLossIndexFinOnePhalanx.Text = "";
            txtLossMidFinThreePhalanges.Text = "";
            txtLossMidFinTwoPhalanges.Text = "";
            txtLossMidFinOnePhalanx.Text = "";
            txtLossRingFinThreePhalanges.Text = "";
            txtLossRingFinTwoPhalanges.Text = "";
            txtLossRingFinOnePhalanx.Text = "";
            txtLossLitFinThreePhalanges.Text = "";
            txtLossLitFinTwoPhalanges.Text = "";
            txtLossLitFinOnePhalanx.Text = "";
            txtLossAllToesOneFoot.Text = "";
            txtLossGToeTwoPhalanges.Text = "";
            txtLossGToeOnePhalanx.Text = "";
            txtLossOToeOneMorePhalanges.Text = "";
            txtThirdDegreeBurn.Text = "";

            txtDeathPTDCash.Text = "0";
            txtTotalParalysisCash.Text = "0";
            txtLossShightBotheyeCash.Text = "0";
            txtLossSpeechCash.Text = "0";
            txtLossHearingBothearCash.Text = "0";
            txtLossShightOneeyeCash.Text = "0";
            txtLossHearingOneearCash.Text = "0";
            txtLossSEHKAWCash.Text = "0";
            txtLossOneThumbCash.Text = "0";
            txtLossOneforefingerCash.Text = "0";
            txtOthFingerOnebigtoeCash.Text = "0";
            txtAnyOthertoeCash.Text = "0";
        }
        else if (Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString()) == 30)
        {
            pnlPercentage.Visible = false;
            pnlAmount.Visible = true;
            txtDeathPTDCash.Text = "";
            txtTotalParalysisCash.Text = "";
            txtLossShightBotheyeCash.Text = "";
            txtLossSpeechCash.Text = "";
            txtLossHearingBothearCash.Text = "";
            txtLossShightOneeyeCash.Text = "";
            txtLossHearingOneearCash.Text = "";
            txtLossSEHKAWCash.Text = "";
            txtLossOneThumbCash.Text = "";
            txtLossOneforefingerCash.Text = "";
            txtOthFingerOnebigtoeCash.Text = "";
            txtAnyOthertoeCash.Text = "";

            txtDeathPTD.Text = "0";
            txtLossOneLimb.Text = "0";
            txtLossTwoLimb.Text = "0";
            txtLossShightOneeye.Text = "0";
            txtLossShightBotheye.Text = "0";
            txtLossHearingOneear.Text = "0";
            txtLossHearingBothear.Text = "0";
            txtLossSpeech.Text = "0";
            txtTotalParalysis.Text = "0";
            txtPerBedridden.Text = "0";
            txtLossFingRH.Text = "0";
            txtLossFingLH.Text = "0";
            txtLossFingOneHand.Text = "0";
            txtLossThumbBothPhalanges.Text = "0";
            txtLossThumbRPhalanx.Text = "0";
            txtLossThumbLPhalanx.Text = "0";
            txtLossIndexFinThreePhalanges.Text = "0";
            txtLossIndexFinTwoPhalanges.Text = "0";
            txtLossIndexFinOnePhalanx.Text = "0";
            txtLossMidFinThreePhalanges.Text = "0";
            txtLossMidFinTwoPhalanges.Text = "0";
            txtLossMidFinOnePhalanx.Text = "0";
            txtLossRingFinThreePhalanges.Text = "0";
            txtLossRingFinTwoPhalanges.Text = "0";
            txtLossRingFinOnePhalanx.Text = "0";
            txtLossLitFinThreePhalanges.Text = "0";
            txtLossLitFinTwoPhalanges.Text = "0";
            txtLossLitFinOnePhalanx.Text = "0";
            txtLossAllToesOneFoot.Text = "0";
            txtLossGToeTwoPhalanges.Text = "0";
            txtLossGToeOnePhalanx.Text = "0";
            txtLossOToeOneMorePhalanges.Text = "0";
            txtThirdDegreeBurn.Text = "0";
        }
    }

    private void CheckMainPageAccess()
    {
        Int64 PageAccess = General.GetProviderMainPageAccess(Convert.ToInt64(Session[General.ProviderCompanyId].ToString()),
                                                        Convert.ToInt64(Session[General.UserId].ToString()), PageName);
        if (PageAccess == 0)
        {
            //Response.Redirect("~/Provider/UserMessage.aspx?errorcode=2000");
            Response.Redirect("~/Provider/UserMessage.aspx?mt=UM&ec=2000");
        }
    }

    private void CheckSubPageAccess()
    {
        Int64 PageAccess = General.GetProviderSubPageAccess(Convert.ToInt64(Session[General.ProviderCompanyId].ToString()),
                                                        Convert.ToInt64(Session[General.UserId].ToString()), SubPageName);
        if (PageAccess == 0)
        {
            //Response.Redirect("~/Provider/UserMessage.aspx?errorcode=2000");
            Response.Redirect("~/Provider/UserMessage.aspx?mt=UM&ec=2000");
        }
        else if (PageAccess == 100)
        {
            ibtSubmit.Enabled = false;
            btnNew.Enabled = false;
            //btnDelete.Enabled = false;
        }
        else if (PageAccess == 200)
        {
            ibtSubmit.Enabled = true;
            btnNew.Enabled = true;
            //btnDelete.Enabled = false;
        }
        else if (PageAccess == 300)
        {
            ibtSubmit.Enabled = true;
            btnNew.Enabled = true;
            //btnDelete.Enabled = true;
        }
    }

}
